<template>
  <div>
     <div>{{teacher.name}}</div>
     <div>{{teacher.age}}</div>
     <div>{{teacher.money}}</div>
     <button @click="fn">过了一年</button>
   </div>
</template>
 
<script>
export default {
  data() {
    return {
      teacher:{
        name:'佩奇',
        age:25,
        money:5000,
      }
    };
  },
  methods:{
    fn(){
      this.teacher.age+=1,
      this.teacher.money+=1000
    }
  },
  watch: {
    'teacher':{
      deep: true,
      handler(newVal){
        this.teacher.age>65?alert('退休，工资'+newVal.money):''
      }
    }
  },
};
</script>

<style scoped>
     
</style>